<?php
 session_start();
 if ( intval($_SESSION['uid']) < 1 ){
     
     header("Location: user_login.php");
     die("未登录，请先登录 <a href='user_login.php'>用户登录</a> ");
 }
    $resume_id = intval($_GET['id']);
    if($resume_id < 1 ) die("错误的简历ID");
    

    $dbms='mysql';     //数据库类型
    $host='localhost'; //数据库主机名
    $dbName='fcoucv';    //使用的数据库
    $user='root';      //数据库连接用户名
    $pass='40qGYxok';          //对应的密码
    $dsn="$dbms:host=$host;dbname=$dbName";

    //根据id从Mysql找出对应的简历
    try {
        $dbh = new PDO($dsn, $user, $pass); //初始化一个PDO对象
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //设置错误模式
        
        //数据库操作
        $sql = "SELECT * FROM `resume` WHERE id = ? Limit 1";
        $result = $dbh->prepare($sql);
        $result->execute([ $resume_id]);

        //$resume_list = $result->fetchall();
        $result_list = $result->fetch();
        //print_r($result_list);
        

    } catch (PDOException $e) {
        die ("Error!: " . $e->getMessage() . "<br/>");
    }
    
?>
<html>
<head>
    <meta charset="utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />  
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简历修改</title>
    <link rel="stylesheet" type="text/css" media="screen" href="main.css"/>
    <link rel="stylesheet" type="text/css" media="screen" href="list.css"/> 
	<script src=http://lib.sinaapp.com/js/jquery/3.1.0/jquery-3.1.0.min.js></script> 
	<script src="send_form.js"></script>
</head>
<body>
    <?php include 'header.php' ?>
	<div class="container_resume">
	<h1>简历修改</h1>
	<form action="resume_save.php" method="post" id="form_resume_edite" onsubmit="send_form('form_resume_edite'); return false;">
        <div id="form_resume_edite_notice" class='form_info'></div>
        <input type="hidden" name = "id" value = <?php print_r( $resume_id )?>/>
        <p> <input type="text" name="title" value = <?php print_r( $result_list["title"] )?> >  </p>

		<textarea  name="content"><?php print_r($result_list["content"])?></textarea>
		
		<p><input type="submit" value="保存简历" class="button_zhuce"></p>
	</form>
	</div>
</body>
</html>